package com.settlement.system.model.entity.common;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.settlement.system.converter.DateFormatConvert;
import com.settlement.system.converter.WpClassifyConvert;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * WP-导入调整明细
 * @author xiaochuan
 * @since 2022-07-26
 */
@Data
@ExcelIgnoreUnannotated
@HeadStyle(fillBackgroundColor = 9,fillForegroundColor = 9)
@HeadRowHeight(value = 20)
@HeadFontStyle(fontHeightInPoints = 14)
public class TblWpAdjustBillDtl extends BaseModel implements Serializable {


    /**
     * 1、来货差异 2、退供差异
     */
    @ColumnWidth(15)
    @ExcelProperty(value = "分类",converter = WpClassifyConvert.class)
    @ApiModelProperty(value = "1、来货差异 2、退供差异")
    @NotNull(message = "分类字段不能为空或者填写错误")
    private String classify;

    /**
     * PO单号
     */
    @ColumnWidth(15)
    @ExcelProperty(value = "PO单号")
    @ApiModelProperty(value = "PO单号")
    @NotNull(message = "PO单号不能为空")
    private String poNo;

    /**
     * 商品条码
     */
    @ColumnWidth(20)
    @ExcelProperty(value = "商品条码")
    @ApiModelProperty(value = "商品条码")
    @NotNull(message = "商品条码不能为空")
    private String barCode;

    /**
     * 单号：分类=来货差异时，对应送货单号；分类=退供差异时，对应退供单号；
     */
    @ColumnWidth(22)
    @ExcelProperty(value = "送货单号/退供单号")
    @ApiModelProperty(value = "单号：分类=来货差异时，对应送货单号；分类=退供差异时，对应退供单号；")
    private String billNo;

    /**
     * 调整数量
     */
    @ColumnWidth(15)
    @ExcelProperty(value = "调整数量")
    @ApiModelProperty(value = "调整数量")
    @NotNull(message = "调整数量不能为空")
    private int adjustQty;

    /**
     * 调整金额
     */
    @ColumnWidth(15)
    @ExcelProperty(value = "调整金额")
    @ApiModelProperty(value = "调整金额")
    @NotNull(message = "调整金额不能为空")
    private Double adjustAmount;

    /**
     * 调整日期
     */
    @ColumnWidth(15)
    @ExcelProperty(value = "调整日期",converter = DateFormatConvert.class)
    @ApiModelProperty(value = "调整日期")
    @NotNull(message = "调整日期不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date adjustDate;

    /**
     * 调整描述
     */
    @ColumnWidth(20)
    @ExcelProperty(value = "调整描述")
    @ApiModelProperty(value = "调整描述")
    @NotNull(message = "调整描述不能为空")
    private String adjustDescription;

    /**
     * 创建人
     */
    @ColumnWidth(15)
    @ApiModelProperty(hidden = true)
    @ExcelProperty(value = "操作人")
    public String createUser;

    /**
     * 创建时间
     */
    @ColumnWidth(22)
    @ApiModelProperty(hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ExcelProperty(value = "操作时间")
    public Date createTime;

    public TblWpAdjustBillDtl() {

    }

    public TblWpAdjustBillDtl(String classify, int adjustQty) {
        this.classify = classify;
        this.adjustQty = adjustQty;
    }
}
